define(
    function (require) {
        var BaseListModel = require('common/ListModel');
        var Data = require('./Data');
        var datasource = require('er/datasource');

        function SurpriseProductListModel() {
            BaseListModel.apply(this, arguments);
            var entityName = this.getUrlType();
            this.addData(new Data(entityName));
            if (arguments.length > 0) {
                var shopid = arguments[0].shopid;
                if (shopid !== '' && typeof(shopid) !== 'undefined') {
                    this.datasource = {
                        list: function (model) {
                            return model.data().searchByShopid(shopid).then(
                                function (data) {
                                    return data;
                                }
                            );
                        }
                    };
                } else {
                    this.datasource = {
                        list: function (model) {
                            return model.data().search().then(
                                function (data) {
                                    return data;
                                }
                            );
                        }
                    };
                }
            } else {
                this.datasource = {
                    list: function (model) {
                        return model.data().search().then(
                            function (data) {
                                return data;
                            }
                        );
                    }
                };
            }
        }
        
        SurpriseProductListModel.prototype.prepare = function() {
            var list = this.get('list');
            this.set('list', list);
        };

        require('er/util').inherits(SurpriseProductListModel, BaseListModel);
        return SurpriseProductListModel;
    }
);
